package com.mmlc.meimei.lichengkongjian.been;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/7/20 0020.
 * 物流订单列表
 */
public class LogisticstBean implements Parcelable{
    public String orderId;//订单id
    public String sourceInfo ;//信息来源
    public List<ItemBean> itemBeenList = new ArrayList<>();



    public static class ItemBean implements Parcelable {

        public String imgUrl;//图片链接
        public String firstTitle;//商品首标题
        public String secondTitle;//商品二级标题
        public String shopPrice;//商品价格
        public String shopCount;//商品数量


        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.imgUrl);
            dest.writeString(this.firstTitle);
            dest.writeString(this.secondTitle);
            dest.writeString(this.shopPrice);
            dest.writeString(this.shopCount);
        }

        public ItemBean() {
        }

        protected ItemBean(Parcel in) {
            this.imgUrl = in.readString();
            this.firstTitle = in.readString();
            this.secondTitle = in.readString();
            this.shopPrice = in.readString();
            this.shopCount = in.readString();
        }

        public static final Creator<ItemBean> CREATOR = new Creator<ItemBean>() {
            @Override
            public ItemBean createFromParcel(Parcel source) {
                return new ItemBean(source);
            }

            @Override
            public ItemBean[] newArray(int size) {
                return new ItemBean[size];
            }
        };
    }

    public void putItemBean(String imgUrl, String firstTitle ,String secondTitle,String shopPrice,String shopCount){
        ItemBean itemBean = new ItemBean();
        itemBean.imgUrl = imgUrl;
        itemBean.firstTitle = firstTitle;
        itemBean.secondTitle = secondTitle;
        itemBean.shopPrice = shopPrice;
        itemBean.shopCount = shopCount;
        itemBeenList.add(itemBean);
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.orderId);
        dest.writeString(this.sourceInfo);
        dest.writeList(this.itemBeenList);
    }

    public LogisticstBean() {
    }

    protected LogisticstBean(Parcel in) {
        this.orderId = in.readString();
        this.sourceInfo = in.readString();
        this.itemBeenList = new ArrayList<ItemBean>();
        in.readList(this.itemBeenList, ItemBean.class.getClassLoader());
    }

    public static final Creator<LogisticstBean> CREATOR = new Creator<LogisticstBean>() {
        @Override
        public LogisticstBean createFromParcel(Parcel source) {
            return new LogisticstBean(source);
        }

        @Override
        public LogisticstBean[] newArray(int size) {
            return new LogisticstBean[size];
        }
    };
}
